<%@page import="java.util.List"%>
<%@page import="com.jfinal.plugin.activerecord.Page"%>
<%@page import="com.hongye.app.model.UserAppModel"%>
<%@page import="com.hongye.app.model.BuyerAddressModel"%>
<%@page import="com.hongye.app.model.BuyerStatisticsModel"%>
<%@page import="com.hongye.app.model.GoodsModel"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false"
    pageEncoding="UTF-8"%>
 <% UserAppModel uam = (UserAppModel)request.getAttribute("userdetail"); %>
<!doctype html>
<html class="fixed">
	<head>
		<!-- Basic -->
		<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="keywords" content="HTML5 Admin Template" />
		<meta name="description" content="Porto Admin - Responsive HTML5 Template">
		<meta name="author" content="okler.net">
		<!-- Mobile Metas -->
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<!-- Vendor CSS -->
		<link rel="stylesheet" href="../admin/css/bootstrap.css" />
		<link rel="stylesheet" href="../admin/css/font-awesome/css/font-awesome.css" />
        <link rel="stylesheet" href="../admin/css/select2.css" />
		<!-- Theme CSS -->
		<link rel="stylesheet" href="../admin/css/theme.css" />
		<!-- Skin CSS -->
		<link rel="stylesheet" href="../admin/css/default.css" />
		<!-- Theme Custom CSS -->
		<!-- Theme Custom ../admin/css -->
		<script src="../admin/js/modernizr.js"></script>
	</head>
	<body>
		<section role="main" class="content-body" style="margin-top: 50px; height:1800px;">
			<!-- start: page --> 
			<section class="panel">
				<header class="panel-heading"> 
					<h2 class="panel-title">用户-详情</h2>
				</header>
				<div class="panel-body">
					<div class="panel-body">
						<p class="lead"> <span class="alternative-font">用户详情</span> </p>
						<p>用户昵称：<%=uam.get("nick") %></p>
						<p>创建日期：<%=uam.get("r_time") %></p>
						<p>用户状态：<%int state=uam.getInt("status"); 
								if(state==0){out.println("正常");}else{out.println("被冻结");} %></p>
						
						<p>	修改状态：
							<input type="radio" name="state" value="0" checked="<%int state_1=uam.getInt("status"); if(state_1 == 0){out.println("true");} %>" />解冻
							<input type="radio" name="state" value="1" checked="<%int state_2=uam.getInt("status"); if(state_2 == 1){out.println("true");} %>" />冻结
						</p>
						<div class="text-center">
						<a class="btn btn-facebook mb-md ml-xs mr-xs" onclick="changeState()">确定提交 </a>
                        <a class="btn btn-facebook mb-md ml-xs mr-xs" href="../admin/userView" >取消</a>
					</div>
					<div class="panel-body">
						<p class="lead"> <span class="alternative-font">用户地址列表</span> </p>
						<%List<BuyerAddressModel> addresslist=(List)request.getAttribute("addresslist");
											for(int i=1;i<=addresslist.size();i++){
												BuyerAddressModel address=addresslist.get(i-1);
											%>
											<p>
												<ul class="list-inline">
													<li>地址ID：<%=address.get("id") %></li>
													<li>收货人：<%=address.get("consignee") %></li>
													<li>国家：<%=address.get("country") %></li>
													<li>省：<%=address.get("province") %></li>
													<li>市：<%=address.get("city") %></li>
													<li>区：<%=address.get("district") %></li>
													<li>具体地址：<%=address.get("address") %></li>
													<li>邮编：<%=address.get("zipcode") %></li>
													<li>配送时间：<%=address.get("best_time") %></li>
													<li>是否为默认：<%int status=address.getInt("state"); 
													if(status==0){out.println("是");}else{out.println("否");} %></li>
												</ul>
											</p>
											<%} %>
											
					</div>
					<div class="panel-body">
						<p class="lead"> <span class="alternative-font">用户商品列表</span> </p>
						<section class="panel">
						<header class="panel-heading">
							<h2 class="panel-title">用户商品列表</h2>
						</header>
						<div class="panel-body">
							<div class="row">
								<div class="col-sm-6">
								</div>
							</div>
							<table class="table table-bordered table-striped mb-none" id="datatable-default">
							<thead>
								<tr>
									<th>序号</th>
									<th class="hidden-phone center">商品名称</th>
									<th class="hidden-phone center">商品类别id</th>
									<th class="hidden-phone center">真实价格</th>
									<th class="hidden-phone center">库存</th>
									<th class="hidden-phone center">销量</th>
									<th class="hidden-phone center">上传时间</th>
									<th class="hidden-phone center">描述</th>
									<th class="hidden-phone center">审核是否通过</th>
									<th class="hidden-phone center">上架状态</th>
								</tr>
							</thead>
							<tbody>
								<%List<GoodsModel> goodslist=(List)request.getAttribute("goodslist");
												for(int i=1;i<=goodslist.size();i++){
													GoodsModel goods=goodslist.get(i-1);
												%>
											<tr class="gradeA">
												<td><%=i %></td>
												<td><%=goods.get("g_name") %></td>
												<td class="center hidden-phone"><%=goods.get("c_id") %></td>
												<td class="center hidden-phone"><%=goods.get("real_price") %></td>
												<td class="center hidden-phone"><%=goods.get("stock") %></td>
												<td class="center hidden-phone"><%=goods.get("sales") %></td>
												<td class="center hidden-phone"><%=goods.get("c_time") %></td>
												<td><%=goods.get("content") %></td>
												<td class="center hidden-phone"><%int audit=goods.getInt("audit"); 
														if(audit==0){out.println("未审核");}
														else if(audit==1){out.println("审核通过");}
														else{out.println("未通过");} %></td>
												<td class="center hidden-phone"><%int sale=goods.getInt("sale"); 
														if(sale==0){out.println("上架");}else{out.println("下架");} %></td>
											</tr>
											<%} %>
							</tbody>
							</table>
						</div>
						</section>
					</div>
				</div>
			</section>
<!-- Specific Page Vendor -->
		<!-- Vendor -->
		<script src="../admin/js/jquery.js"></script>
		<script src="../admin/js/jquery-browser-mobile/jquery.browser.mobile.js"></script>
		<script src="../admin/js/bootstrap/js/bootstrap.js"></script>
		<script src="../admin/js/nanoscroller/nanoscroller.js"></script>
		<script src="../admin/js/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
		<script src="../admin/js/magnific-popup/magnific-popup.js"></script>
		<script src="../admin/js/jquery-placeholder/jquery.placeholder.js"></script>
		
		<!-- Specific Page Vendor -->
	<!--	<script src="js/select2.js"></script>-->
		<script src="../admin/js/jquery-datatables/media/js/jquery.dataTables.js"></script>
		<script src="../admin/js/jquery-datatables-bs3/assets/js/datatables.js"></script>
		
		<!-- Theme Base, Components and Settings -->
		<script src="../admin/js/theme.js"></script>
		
		<!-- Theme Custom -->
		<script src="../admin/js/theme.custom.js"></script>
		
		<!-- Theme Initialization Files -->
		<script src="../admin/js/theme.init.js"></script>


		<!-- Examples -->
		<script src="../admin/js/tables/examples.datatables.default.js"></script>
		<script src="../admin/js/tables/examples.datatables.row.with.details.js"></script>
		<script src="../admin/js/tables/examples.datatables.tabletools.js"></script>
<script type="text/javascript">
function changeState(){
	var id = ${id};
	var state = $('input[name="state"]:checked').val();
	$.get('../admin/changeUserState?state='+state+'&id='+id,function(data){
		if(data=='suc'){
			location.href='../admin/userView';
		}else{
			alert('提交失败!');
		}
	});
}
</script>
</body>

</html>